package cn.heiliu.selenium.domain;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;

/**
 * @author wangyelou
 * @date 2021/6/14
 */
@Getter
public class SeleniumProxy {

    private String schema = "http";

    private String host;

    private int port;

    private String userName;

    private String passWord;

    public SeleniumProxy() {
    }

    public SeleniumProxy(String schema, String host, int port, String userName, String passWord) {
        this.schema = schema;
        this.host = host;
        this.port = port;
        this.userName = userName;
        this.passWord = passWord;
    }

    public SeleniumProxy(String host, int port) {
        this.host = host;
        this.port = port;
    }

    /**
     * 是否为空
     * @return
     */
    public boolean isEmpty() {
        return StrUtil.hasEmpty(schema, host) || port <= 0;
    }

    /**
     * 是否认证
     * @return
     */
    public boolean isAuth() {
        return !isEmpty() && !StrUtil.hasEmpty(userName, passWord);
    }


}
